const weibo = require('./collector/weibo.js');

const collectors = new Map();
 
// 注册采集方法
collectors.set('weiboScanFeed', weibo.scanAndFilterUrls);

/**
 * 执行采集方法
 * @param {string} methodName - 方法名称
 * @param {import('playwright').Page} page - Playwright 页面对象
 * @param {import('./types/collectors.js').ExtraData} extraData - 额外数据
 * @param {import('./types/collectors.js').CollectorOptions} options - 配置选项
 * 
 */
async function scanAndFilterUrls(page, extraData = {}, options = {}) {
    const collector = collectors.get('scanWeiboFeed');
    if (!collector) {
        throw new Error(`采集方法 scanWeiboFeed 未找到`);
    }
    return await collector(page, extraData, options);
}

module.exports = {
    scanAndFilterUrls,
    collectors
};